﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace canyinguanlixitong
{
    public partial class frm配料设置 : Form
    {
        public frm配料设置()
        {
            InitializeComponent();
        }
        //连接数据库
        string str = "Data Source=.;Initial Catalog=Supermarket management system;Integrated Security=True";
      
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        //查询
        public void add() {
            SqlConnection conn = new SqlConnection(str);
            string sql = @"select spID,spName,spJia,danwei,kuchun from dbo.commodity,dbo.sangping
where dbo.commodity.spID=dbo.sangping.commid";
            DataSet ds = new DataSet("Student");
            SqlDataAdapter asdf = new SqlDataAdapter(sql,conn);
            asdf.Fill(ds,"Student");
        this.dgvqw1.DataSource=ds.Tables["Student"];
        
        }
        //窗体加载
        private void frm配料设置_Load(object sender, EventArgs e)
        {
            add();
        }
        //查询按钮
        private void button5_Click(object sender, EventArgs e)
        {
            add();
        }
        //增加
        private void button1_Click(object sender, EventArgs e)
        {
            
        }
    }
}
